import { defineConfig } from "vite";
import path from "path";

export default defineConfig(({ command, mode }) => {
  return {
    build: {
      target: "esnext",
      lib: {
        entry: path.resolve(__dirname, "./src/formula_lib.ts"), // 库的入口点
        name: "formula_lib", //暴露的全局变量
        formats: ["es", "cjs", "umd"],
        fileName: (format, entryName) => `${entryName}.${format}.js`,
      },
      emptyOutDir: true,
      minify: true,
      sourcemap: false,
    }, //build
    server: {
      host: "0.0.0.0",
      port: 5173,
      open: true,
    }, //server
  }; //return
});
